package com.itheima.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * ClassName:BCryptPasswordEncoderUtils
 * Package:com.itheima.utils
 * Description:
 * Date:2020/3/12 1:25
 * User: snow
 */
public class BCryptPasswordEncoderUtils {

	private static BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

	public static String encodePassword(String password){
		return bCryptPasswordEncoder.encode(password);
	}

	//测试
	public static void main(String[] args) {
		String password = "123";
		String str = encodePassword(password);
		// $2a$10$fKUIY0I/aoqx9cKqinisnOWqiEnY.Vsd/sr12T.aFAyMnr.aRU3wK
		// $2a$10$1Jxc/KqWeosD6FNgFB60bO9T7alB..kcsjm2zW5g2FJigggKQyi9a
		System.out.println(str);
	}
}
